<?php
/* @var $this CompanyController */
/* @var $model Company */
/* @var $form CActiveForm */ 
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'company-form',
	'enableAjaxValidation'=>false,
	'htmlOptions' => array('enctype'=>'multipart/form-data'),
)); ?>

	<p class="note"><span class="required">*</span> 是必填内容.</p> 

	<?php //echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'username'); ?>
		<?php echo $form->textField($model,'username',array('size'=>60,'maxlength'=>128)); ?>
		<?php echo $form->error($model,'username'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'password'); ?>
		<?php echo $form->passwordField($model,'password',array('size'=>60,'maxlength'=>128)); ?>
		<?php echo $form->error($model,'password'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>128)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'logo'); ?>
		<?php echo CHtml::activeFileField($model,'logo'); ?>
		<?php echo $form->error($model,'logo'); ?>
	</div>

	<div class='row'> 
        <?php  
          if($model->logo !==null){ 
 			echo CHtml::label("企业logo预览",false); 
          	echo CHtml::image(Yii::app()->baseUrl.$model->logo,'',array("width"=>"80px","height"=>"80px")); 
          }  
         ?>
    </div>

	<div class="row">
		<?php echo $form->labelEx($model,'description'); ?>
		<?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>50));  ?>
		<?php echo $form->error($model,'description'); ?>
	</div> 

	<div class="row">
		<?php echo $form->labelEx($model,'tel'); ?>
		<?php echo $form->textField($model,'tel'); ?>
		<?php echo $form->error($model,'tel'); ?>
	</div> 

    <div class="row">
        <?php echo $form->labelEx($model,'address'); ?>
        <?php echo $form->textField($model,'address'); ?>
        <?php echo $form->error($model,'address'); ?>
    </div> 

	<div class="row">
		<?php echo $form->labelEx($model,'point'); ?>
		<?php echo $form->textField($model,'point'); ?>
		<?php echo $form->error($model,'point'); ?>
	</div>

    <div class="row">
        <?php echo $form->labelEx($model,'template'); ?>
            <?php echo $form->dropDownList(
                  $model,
                  'template',
                CHtml::listData(
                   $templates,
                    'id',
                    'title'
                )
            ); ?>
    </div>

    <div class="row" id="tags_check">
        <?php echo $form->labelEx($model,'分类'); ?>
        <?php
        $companyTag = CompanyTag::model()->findAll("companyid=:id", array(':id' => $model->id));
        $selected = array();
        foreach($companyTag as $v){
            $selected[]= $v['tagid'];
        }
        echo CHtml::checkBoxList('tags',$selected, CHtml::listData( Tag::model()->findAll(), 'id', 'title') );?>
    </div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? '新增' : '修改',array('class'=>'subButton')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->